import { BasicColumn, FormSchema } from '@/components/Table';

export const columns: BasicColumn[] = [
  {
    title: '名称',
    dataIndex: 'name',
    width: 100,
    align: 'left',
  },
  {
    title: 'Key',
    dataIndex: 'key',
    width: 200,
    align: 'left',
  },
  {
    title: '数据库',
    dataIndex: 'source_db',
    width: 100,
    align: 'left',
  },
  {
    title: '数据表',
    dataIndex: 'source_table',
    width: 100,
    align: 'left',
  },
  {
    title: '指定主键',
    dataIndex: 'primary_key',
    width: 80,
    align: 'left',
  },
  {
    title: '指定更新时间字段',
    dataIndex: 'source_updated_at_field',
    width: 180,
    align: 'left',
  },
  {
    title: 'sql过滤器',
    dataIndex: 'sql_filter',
    width: 180,
    align: 'left',
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'name',
    label: '名称',
    component: 'Input',
    colProps: { span: 8 },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'name',
    label: '名称',
    required: true,
    component: 'Input',
  },
  {
    field: 'key',
    label: 'Key',
    required: true,
    component: 'Input',
  },
  {
    label: ' ',
    field: 'field1',
    slot: 'field1',
    component: 'Input',
  },
];

export const basicSchemas: FormSchema[] = [
  {
    field: 'db',
    label: '数据库',
    required: true,
    component: 'Input',
    slot: 'db',
  },
  {
    field: 'table',
    label: '数据表',
    required: true,
    component: 'Input',
    colProps: {
      offset: 2,
    },
    slot: 'table',
  },
  {
    field: 'name',
    label: '名称',
    required: true,
    component: 'Input',
  },
  {
    field: 'key',
    label: 'Key',
    required: true,
    component: 'Input',
    colProps: {
      offset: 2,
    },
  },
  {
    field: 'source_updated_at_field',
    label: '指定更新时间字段',
    required: true,
    component: 'Input',
  },
  {
    field: 'sql_filter',
    label: 'sql过滤器',
    required: true,
    component: 'Input',
  },
];
